package com.foreverwin.jzymes.production.program.service;

import com.foreverwin.jzymes.production.program.domain.CncProgram;
import com.foreverwin.jzymes.production.program.domain.CncProgramItem;
import org.apache.commons.fileupload.FileItem;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.List;
import java.util.Map;

public interface ICncProgramAdviceService {

    /**
     * 保存机种程式
     *
     * @param cncProgram
     * @param cncProgramItems
     */
    public void saveCncProgram( CncProgram cncProgram, List<CncProgramItem> cncProgramItems );

    /**
     * 解析程式包
     *
     * @param file
     * @param machineType
     * @param cncType
     * @param prgmCode
     * @param revision
     * @param subSeq
     * @return
     * @throws Exception
     */
    public List<Map<String,String>> uploadProgram(MultipartFile file, String machineType, String cncType, String prgmCode, String revision, String subSeq );

    /**
     * 解析上传程式包
     *
     * @param fileItem
     * @param req
     * @return
     */
    public List<Map<String,String>> uploadProgram(FileItem fileItem, HttpServletRequest req );

    /**
     * 上传程式到cnc
     *
     * @param site
     * @param resrce
     * @param machineType
     * @param cncType
     * @param prgmCode
     * @param revision
     * @param subSeq
     * @param programFile
     */
    public void uploadProgramToCnc( String site, String resrce, String machineType, String cncType, String prgmCode, String revision, String subSeq, String programFile );


    /**
     * 从cnc下载程序并压缩
     *
     * @param site
     * @param resrce
     * @return
     */
    public File downloadProgramFromCnc( String site, String resrce );

    /**
     * 打包程式子程式清单
     *
     * @param cncProgram
     * @param cncProgramItems
     * @return
     */
    public File zipProgramItem(CncProgram cncProgram, List<CncProgramItem> cncProgramItems  );

    /**
     * 查询机种程式
     *
     * @param site
     * @param machineType
     * @param cncType
     * @param prgmCode
     * @param revision
     * @param subSeq
     * @return
     */
    public CncProgram findCncProgram(String site, String machineType, String cncType, String prgmCode, String revision, String subSeq );

    /**
     * 查询当前版本机种程式
     *
     * @param site
     * @param machineType
     * @param cncType
     * @return
     */
    public CncProgram findCurrentRevCncProgram( String site, String machineType, String cncType );
}
